


  
  <script>
function Del_Info(str){
	var q=confirm('Bạn có chắc chắn muốn xóa hay không?');	
	if(q==true) 
		window.location=str;
	
}
</script>

<?php
$sql="SELECT substr( QUYEN,13, 1 ) as mq
FROM qldl_tai_khoan
WHERE ten_dang_nhap = '".$_SESSION['username']."'";
	$query = @mysql_query($sql,$conn);
	$row = @mysql_fetch_array($query);
	if($row['mq']==1){
	 header('Location: index.php?page=id_edit_kt&amp;id_edit_kt="'.$_GET['id_edit_kt'].'"'); 
	}
	else {
	echo  "<script>alert ('Bạn không có quyền truy cập trang này!')</script>"; 
	echo "<meta http-equiv='refresh' content='0;url= index.php'>";
	}
?>
<div class="cpanel-right-tttk">
  <div id="panel-sliders" class="pane-sliders">
    <div class="panel">
<table width="100%" border="0" cellspacing="0" cellpadding="0" style=" padding:10px;">
  <thead>
        <tr style=" padding-bottom:10px;">
        <th colspan="3" align="left" style="padding-bottom:10px;">QUẢN LÍ TỈNH THÀNH PHỐ</th>
        </tr> 
        </thead> 
  <tr valign="top" style="padding:5px;">
    <td width="40%"><div style=" padding:10px; border-top: medium none; border-bottom: medium none; overflow: hidden; height: auto; width:100%" align="left">
      <table width="81%" height="113" border="1" bordercolor="#666666" class="adminlist_tt">
        <thead>
          <tr>
            <th colspan="3" align="center"> Thông tin thêm tỉnh/thành phố</th>
          </tr>
     <?php if(isset($_POST['btn_edit_ttp'])){ 
	$a=$_GET['id_edit_ttp'];
	$b=$_POST['txt_ttp'];
	$c=$_POST['select_qg'];
	/////////////////////////////
	$sql1 = "update qldl_tinh_thanh_pho set				
				THANH_PHO='$b',
				MA_QUOC_GIA='$c'
			where MA_TP='$a'
			";
	$query1 = @mysql_query($sql1,$conn);
	if($query1)echo "<script>alert ('Cập nhật thông tin thành công.')</script>";	
	else echo "<script>alert ('Lỗi cập nhật thông tin!')</script>";	
}
?>
        </thead>
        <tbody>
         <form action="" method="post" name="form_edit" id="form_edit" onsubmit="return input_edit();">
<?php  
	$sql="select * from qldl_tinh_thanh_pho where MA_TP='".$_GET['id_edit_ttp']."'";
	$query = @mysql_query($sql,$conn);	
	if(!$query) echo "Query error to display.";
	else $row = @mysql_fetch_array($query);
		
  ?>
          <tr>
            <td width="122">Mã tỉnh/thành phố</td>
            <td width="251" colspan="2" >
              <label for="txt_ma_loai_tour"></label>
              <input type="text" name="txt_ma_ttp" id="txt_ma_ttp" value="<?php echo $row['MA_TP'];?>" readonly="readonly" />
            </td>
          </tr>
          <tr>
            <td>Mã quốc gia</td>
            <td ><label for="select"></label>
              <?php
						$sql_ttp1="select * from qldl_quoc_gia where MA_QUOC_GIA='".$_GET['id_qg']."'";
						$query_ttp1 = @mysql_query($sql_ttp1,$conn);	
							if(!$query_ttp1)echo "Query error to display.";
							else{
								$row_ttp1 = @mysql_fetch_array($query_ttp1);
						?>
              <select id="select_qg" name="select_qg">
				<option value='<?php echo $row_ttp1['MA_QUOC_GIA'];?>' selected><?php echo $row_ttp1['QUOC_GIA'];?></option>		
						<?php }
							?>
						<?php 
							$sql_qg="select * from qldl_quoc_gia order by MA_QUOC_GIA asc";
							$query_qg = @mysql_query($sql_qg,$conn);	
							if($query_qg)while($row_qg = @mysql_fetch_array($query_qg)){
						?>  
						<option value="<?php echo $row_qg['MA_QUOC_GIA'];?>"><?php echo $row_qg['QUOC_GIA'];?></option>
							<?php }?> 
					</select></td>
          </tr>
          <tr>
            <td>Tỉnh/thành phố</td>
            <td ><input type="text" name="txt_ttp" id="txt_ttp" value="<?php echo $row['THANH_PHO'];?>" /></td>
          </tr>
          <tr>
            <td  colspan="3">
              <input type="submit" name="btn_edit_ttp" id="btn_edit_ttp" value="Lưu" onclick='window.location.href="index.php?page=k_tour"' />
              <input type="reset" name="btn_huy" id="btn_huy" value="Hủy" onclick='window.location.href="index.php?page=k_tour"' />
     
            </td>
          </tr>
          </form>
        </tbody>
      </table>
    </div></td>
    <td width="50%"><div style=" padding:10px; border-top: medium none; border-bottom: medium none; overflow: hidden; height: auto; width:100%" align="left">
      <table width="100%" border="1" bordercolor="#666666" class="adminlist_tt">
        <thead>
          <tr>
            <th colspan="3" align="center"> Danh sách kiểu tỉnh/thành phố</th>
          	<?php include('kieu_tour/del.php'); ?>
          </tr>
        </thead>
        <tbody>
           <form action="" method="post" name="form_view" id="form_view">
          <tr>
            <td width="114" align="center">Mã tỉnh/thành phố</td>
            <td width="328" align="center">Tỉnh/thành phố</td>
            <td width="66">Cập nhật</td>
          </tr>
          <?php  
	$stt=0;
	$sql="select * from qldl_tinh_thanh_pho order by MA_TP".$_GET['sort'];
	$query = @mysql_query($sql,$conn);	
	if(!$query) echo "Query error to display.";
	else while($row = @mysql_fetch_array($query)){
		$stt++;
		?>
          <tr>
            <td><?php echo $row['MA_TP'];?></td>
            <td><?php echo $row['THANH_PHO'];?></td>
            <td><a href="index.php?page=id_edit_ttp&amp;id_edit_ttp=<?php echo $row['MA_TP'];?>&amp;id_qg=<?php echo $row['MA_QUOC_GIA'];?>">Sửa</a> 
            || <a onclick="Del_Info('index.php?page=ttp&amp;id_del_ttp=<?php echo $row['MA_TP']; ?>');" href="#">Xóa</a></td>
          </tr>
          <?php }?>
          </form>
        </tbody>
      </table>
    </div></td>
  </tr>
</table>
</div>
  </div>
</div>